import 'package:flutter/material.dart';
import 'package:zhongyiapp/widgets/custom_app_bar.dart';
import 'package:zhongyiapp/pages/forum/widgets/post_list.dart';

class ForumPage extends StatelessWidget {
  const ForumPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
        appBar: CustomAppBar(
          title: '论坛',
          bottom: const TabBar(
            tabs: [
              Tab(text: '推荐'),
              Tab(text: '问答'),
              Tab(text: '经验'),
            ],
            labelColor: Colors.white,
            unselectedLabelColor: Colors.white70,
            indicatorColor: Colors.white,
          ),
          actions: [
            IconButton(
              icon: const Icon(Icons.edit),
              onPressed: () {
                // TODO: 导航到发帖页面
              },
            ),
          ],
        ),
        body: const TabBarView(
          children: [
            PostList(type: 'recommend'),
            PostList(type: 'qa'),
            PostList(type: 'experience'),
          ],
        ),
      ),
    );
  }
}
